package com.bigdata.controller;

import com.bigdata.entity.pojo.PopularMobilePhones;
import com.bigdata.entity.pojo.Result;
import com.bigdata.entity.vo.NwrVO;
import com.bigdata.service.PmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @author  王铭轩
 *  控制器：负责  热门手机  相关业务处理（22 ~ 27）
 */
@RestController
@RequestMapping("/phone")
public class PopularMpController {

    @Autowired
    private PmpService pmpService;

    /**
     *  获取热门手机
     */
    @GetMapping("/GetPmp")
    public Result<List<PopularMobilePhones>> getPopularMobilePhones(){
        List<PopularMobilePhones> phones = pmpService.getPopularMobilePhones();
        return Result.success(phones);
    }

    /**
     * 22：获取热门手机流量分布
     * @return
     */
    @GetMapping("/distribution")
    public Result<Object> getPmpTrafficLocation(){
        return Result.success(this.pmpService.getPmpTrafficLocation());
    }

    /**
     * 23：获取热门手机网络质量排名
     * @return
     */
    @GetMapping("/network-quality-rank")
    public Result<NwrVO> getPmpNetworkQualityRanking(){
        return Result.success(this.pmpService.getPmpNetworkQualityRanking());
    }

    /**
     * 24：获取热门手机网络质量排名-1
     * @return
     */
    @GetMapping("/flow-rank")
    public Result<Object> getPmpTrafficRankingFlow(){
        return Result.success(this.pmpService.getPmpTrafficRankingFlow());
    }

    /**
     * 24：获取热门手机网络质量排名-2
     * @return
     */
    @GetMapping("/flow-pie")
    public Result<Object> getPmpTrafficRankinPie(){
        return Result.success(this.pmpService.getPmpTrafficRankingPie());
    }

    /**
     * 25：获取热门手机OS流量排名-1
     * @return
     */
    @GetMapping("/os-rank")
    public Result<Object> getPmpOSTrafficRankingRank(){
        return Result.success(this.pmpService.getPmpOSTrafficRankingRank());
    }

    /**
     * 25：获取热门手机OS流量排名-2
     * @return
     */
    @GetMapping("/os-pie")
    public Result<Object> getPmpOSTrafficRankingRankPie(){
        return Result.success(this.pmpService.getPmpOSTrafficRankingPie());
    }

    /**
     * 26：获取热门手机分布图
     * @return
     */
    @GetMapping("/phone-distribution")
    public Result<Object> getPmpDistribution(){
        return Result.success(this.pmpService.getPmpDistribution());
    }

    /**
     * 27：获取热门手机OS分布图
     * @return
     */
    @GetMapping("/os-distribution")
    public Result<Object> getPmpOSDistribution(){
        return Result.success(this.pmpService.getPmpOSDistribution());
    }
}
